package com.yxkj.syh.app.huarong.adps;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

import com.syh.app.basic.base.BaseAdp;
import com.yxkj.syh.app.huarong.R;
import com.yxkj.syh.app.huarong.bean.MsgPreview;

/**
 * 创建者：SYH
 * 时间：2020/6/18 17:00
 * 编辑者：SYH、
 * 标签：
 * 补充说明：
 */
public class MsgListAdp extends BaseAdp<MsgPreview> {

    @Override
    protected RecyclerView.ViewHolder createYourViewHolder(@NonNull ViewGroup parent, int viewType) {
        View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_msg_list,parent,false);
        return new ViewHolder(view);
    }

    @Override
    protected void bindYourViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
        ViewHolder viewHolder = (ViewHolder) holder;
        MsgPreview msgPreview = mData.get(position);

        viewHolder.tvMsg.setText(msgPreview.getContent());
        viewHolder.tvNo.setText(msgPreview.getTitle());
        viewHolder.tvTime.setText(msgPreview.getCreateTime());
    }

    public class ViewHolder extends RecyclerView.ViewHolder {

        TextView tvMsg,tvNo,tvTime;

        public ViewHolder(@NonNull View itemView) {
            super(itemView);
            tvMsg = itemView.findViewById(R.id.tvMsg);
            tvNo = itemView.findViewById(R.id.tvNo);
            tvTime = itemView.findViewById(R.id.tvTime);
        }


    }

}
